package zhangliang.view.android.klibrary.entity;

import java.text.SimpleDateFormat;

/**
 * Created by zhangliang on 16/11/5.
 * QQ:1179980507
 */
public class MarketChartData implements  Comparable<MarketChartData>{
/*    uint32 ui_price_date = 1;
    uint32 ui_price_time = 2;       // 这个是否需要TODO
    uint32 ui_open_price = 3;
    uint32 ui_high_price = 4;
    uint32 ui_low_price = 5;
    uint32 ui_close_price = 6;*/


    long time = 0;  // 时间
    double openPrice = 0;  // 开盘价
    double closePrice = 0; // 收盘价
    double lowPrice = 0;   // 最高价
    double highPrice = 0;  // 最低价
    double vol = 0;

    public double zf;

    public MarketChartData() {

    }

    public long getTime() {
        return time;
    }

    public String getTime2() {
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
        return sdf.format(time*1000);
    }
    public String getTime3() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(time*1000);
    }
    public String getTime4() {
        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
        return sdf.format(time*1000);
    }
    public void setTime(long time) {
        this.time = time;
    }

    public double getOpenPrice() {
        return openPrice;
    }

    public void setOpenPrice(double openPrice) {
        this.openPrice = openPrice;
    }

    public double getClosePrice() {
        return closePrice;
    }

    public void setClosePrice(double closePrice) {
        this.closePrice = closePrice;
    }

    public double getLowPrice() {
        return lowPrice;
    }

    public void setLowPrice(double lowPrice) {
        this.lowPrice = lowPrice;
    }

    public double getHighPrice() {
        return highPrice;
    }

    public void setHighPrice(double highPrice) {
        this.highPrice = highPrice;
    }

    public double getVol() {
        return vol;
    }

    public void setVol(double vol) {
        this.vol = vol;
    }

    @Override
    public int compareTo(MarketChartData o) {
        int i1 = Integer.parseInt(String.valueOf(this.time));
        int i2 = Integer.parseInt(String.valueOf(o.time));
        int i = i1 - i2;//先按照年龄排序
        if(i == 0){
            return i1 -i2;//如果年龄相等了再用分数进行排序
        }
        return i;
    }
}
